<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
            //转字符型：数值，布尔型，null，未定义，
            let num1=123,flag1=true,flag2=false,num2=null,num3;
            //string(),tostrinig()
            //let str1=string(num1);
            let str1 =String(num1); 
            console.log(str1); //123
            console.log(typeof(str1));
            str1 = num1.toString();
            console.log(str1);  //123
            console.log(num1.toString());   //123
            console.log (typeof(str1));
            console.log(Boolean(num1));
            console.log(Boolean(num2));
            console.log(parseFloat(num1));
            console.log(parseInt(num2));
            console.log('----------');
            console.log(String(l=flag1));
        console.log(flag1.toString());
            console.log(String(flag2));
            console.log(flag2.toString());
            console.log('----------');
            console.log(String(num2));
           // console.log(num2.toString());     //null没有tostring()方法
            console.log(String(num3));
            //console.log(num3.toString());     //undefine没有tostring（）方法
        </script>
</html>